\documentclass[11pt,a4paper]{article}
\usepackage[pdftex]{graphicx}	% use this package for importing images/graphics
\usepackage{moreverb}
\usepackage{listings}

\title{Topic Paper}	% enter title here
\date{May 4, 2011}	% date comes here
\author{Stuart Pickering, Jacob Hafdahl\\ Department of Computer Science, University of Minnesota} 	% enter information about the authors
% \\ is used to break a line

\begin{document}
\maketitle	% displays the title
\thispagestyle{empty}	% sets the style of the current page to empty (used here to remove page number from title)

\newpage						% starts a new page
\section{Introduction}	% starting a new section
Madden NFL's defensive AI leaves a lot to be desired. There are many problems, but the focus of our project is defensive back AI. The current implementation for man coverage in Madden has many mistakes. -----List Mistakes----. The question we asked is: Is there a better way to implement man coverage in the Madden video game to allow for better (but not perfect) coverage? We coded two algorithms in C++ to see if our ideas work.
\section{Evaluation Criteria}
To evaluate coverage we needed to define a measurable metric by which we will compare algorithms. We decided to define "covered" as the defensive back(DB) being within 3 feet of the reciever. We believe this is a good metric because in the real NFL most defenders are able to stop a pass completion to a reciever who is 3 or less feet from them, not including the freaks who catch everything.

\section{Algorithm 1}
The first algorithm used the pythagorean theorem for the DB to be able to predict where he needs to be at any given time unit. Depending on which direction the receiver is running, the DB will pick a spot "3 feet" in front of the WR to run to. In figure 1, the WR is running a slant. At each time unit, the DB will calculate its target position based on the direction and velocity of the wide receiver. At each stage the defensive back will take as input the instantaneous velocity, and direction of the wide reciever and will calculate the predicted position and velocity neccessary to reach that predicted position, if the defensive back is already running at its maximum velocity there is no acceleration, otherwise the defender will accelerate. This algorithm is effective because instead of just following the reciver it attempts to predict where he will be at the next time unit. The disadvantage of this algorithm is that it can be abused by multiple directional changes. Here is an example of our first algorithm.
\\The code is shown below:\\\lstset{language=C++}
\begin{lstlisting}
void simDB(){
	double predX,predY;//predicted positions of the reciever
	predX = recX + rec_velX*TIME;
	predY = recY + rec_velY*TIME;
	if(distBetween(dbX,dbY,predX,predY) > db_vel_total*TIME)//if the db cannot get to the positing given his current velocity then accelerate
		accelerate(db_velX,db_velY);
	dbX+= dbX + db_velX*TIME;
	dbY+= dbY + db_velY*TIME;
}
\end{lstlisting}

\includegraphics[width=.45\textwidth]{start.jpg}
\includegraphics[width=.45\textwidth]{step2.jpg}\\
\includegraphics[width=.45\textwidth]{step3.jpg}
\includegraphics[width=.45\textwidth]{step4.jpg}


\section{Algorithm 2}  
The second algorithm is an extension of the first, it uses the assumption that the quarterback will be throwing from a fixed position in the center of the field. This assumption is for simplification of the problem. Because of this assumption we can now add a new feature to the first algorithm. The second algorithm will use the position of the quarterback to adjust the prediction function. It will essentially behave the same as the first but the predicted position will now be offset by 1 foot from a line tangent to the direction of the quarterback. This addition to the algorithm we had previously gives the benefit of using relative positioning to get a better angle of pursuit. The code 
for this algorithm is almost the exact same as the first except for the predX and predY variables are set using this section of code.\\
\begin{lstlisting}
	predX = recX + rec_velX*TIME - offsetX(recX,0.0);
	predY = recY + rec_velY*TIME - offsetY(recY,0.0);
\end{lstlisting}
where offsetX calculates the X offset towards the point (0,0) from the predicted X position and offsetY calculates the Y offset towards the point (0,0) from the predicted Y position.
\end{document}
 
